#pragma once
#include "Utils.h"
#include "Sprites.h"

#define _DATA_DELAY_FOR_DEAD 10

class AbstractData {
public:
	// Unique identity of object
	int id;
	// Type of object
	int type;
	// Current state of object
	int state;
	// Defination rectangle of object
	Rect* rect;
	// List of sprites of object
	Sprites* sprites;
	// Bullet is fired
	bool isFired;
	// Flag for collission
	bool canInteract;
	// Flag for dead
	bool isDead;
	// Flag for deaded
	bool deaded;
	//
	int delayForDead;

	/*list subrect*/
	vector<Rect*>* subRect;

	virtual void initSprite() {
	}

	virtual void initData() {
	}

	virtual void initSpriteHandler() {
	}

	// Default AbstractData constructor
	AbstractData() {
		id = -1;
		type = -1;
		state = 0;
		rect = NULL;
		sprites = NULL;
		isFired = false;
		canInteract = true;
		isDead = false;
		deaded = false;
		delayForDead = -1;
		subRect = NULL;
	}

	// Get rect
	virtual Rect* getRect() { return rect; }
	// Init sprite
	virtual void initSpriteHandler(LPD3DXSPRITE spriteHandler) = 0;
	// Get some basic data
	virtual int getId() {
		return id;
	}
	// 
	virtual void initSubRect() {
		subRect = new vector<Rect*>();
	}

	virtual int getType() {
		return type;
	}

	~AbstractData() {
		delete rect;
		delete sprites;
	}

	virtual void updateData(ACTIONS action, int value) {}
};